package com.example.tvwanandroid.presenter

import com.example.tvwanandroid.base.BaseObserver
import com.example.tvwanandroid.base.BasePresenter
import com.example.tvwanandroid.base.BaseResult
import com.example.tvwanandroid.bean.RegisterBean
import com.example.tvwanandroid.view.RegisterView

/**
 * @作者: njb
 * @时间: 2020/12/9 10:25
 * @描述:
 */
class RegisterPresenter(baseView: RegisterView):BasePresenter<RegisterView>(baseView){
    fun getRegister(username:String,password:String,repassword:String){
        addDisposable(apiServer.register(username,password,repassword),object :BaseObserver<BaseResult<RegisterBean>>(baseView){
            override fun onSuccess(o: BaseResult<RegisterBean>) {
                baseView.onLoadRegister(o)
            }

            override fun onError(msg: String?) {
                baseView.showError(msg!!)
            }

        })
    }
}